<header>
    <div class="bar">
        {{#if loginUser}}
            Hello,<a href="/user/{{loginUser._id}}">{{loginUser.name}}</a>!
            &emsp;
            <a href="/user/{{loginUser._id}}/messages">未读信息
                {{#if messages.length}}
                    ({{messages.length}})
                {{/if}}
            </a>

        {{else}}
            <a href="/login">请登录</a>
        {{/if}}
        <form id="search" class="search" action="/search"><input type="text" name="keyword"><input type="submit" value="Search"></form>
    </div>
    <b>{{title}}</b>
</header>
{{#if success}}
    <div class="success">{{success}}</div>
{{/if}}
{{#if error}}
    <div class="error">{{error}}</div>
{{/if}}
{{>nav}}